package com.cdxy.controller;


import com.cdxy.biz.process.IHotelBizProcess;
import com.cdxy.model.dto.base.controller.BaseController;
import com.cdxy.model.dto.base.resp.ApiResponse;
import com.cdxy.model.dto.base.resp.BasePageResp;
import com.cdxy.model.dto.req.HotelDetailReq;
import com.cdxy.model.dto.req.SearchHotelReq;
import com.cdxy.model.dto.resp.HotelDetailResp;
import com.cdxy.model.dto.resp.SearchHotelResp;
import com.cdxy.util.AxUidUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 酒店表 前端控制器
 * </p>
 *
 * @author autoGenCode
 * @since 2020-03-05
 */
@RestController
@RequestMapping("/hotel")
@Api(tags = "酒店")
public class HotelController extends BaseController {

    @Autowired
    private IHotelBizProcess hotelBizProcess;

    @Autowired
    private AxUidUtil axUidUtil;

    @GetMapping("/searchHotel")
    @ApiOperation(value = "酒店搜索后", notes = "")
    public ApiResponse<BasePageResp<SearchHotelResp>> searchHotel(@Validated SearchHotelReq searchHotelReq) {
        searchHotelReq.setAxUid(axUidUtil.getAxUidNotForce());
        return successApiResponse(hotelBizProcess.searchHotel(searchHotelReq));
    }

    @GetMapping("/hotelDetail")
    @ApiOperation(value = "酒店详情")
    public ApiResponse<HotelDetailResp> hotelDetail(@Validated HotelDetailReq hotelDetailReq) {
        hotelDetailReq.setAxUid(axUidUtil.getAxUidNotForce());
        return successApiResponse(hotelBizProcess.hotelDetail(hotelDetailReq));
    }

}
